﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace Db.Models.Base
{

    public class UploadModelBase:ImageInfoBase
    {

        [SugarColumn(IsPrimaryKey = true)]
        /// <summary>
        /// 主键
        /// </summary>
        public Guid Id { get; set; }

        [SugarColumn(IsNullable = true)]
        public DateTime UploadTime { get; set; }

        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(255)")]
        public string Bucket { get; set; }

        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(255)")]
        public string ImageName { get; set; }
        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(255)")]
        public string Path { get; set; }

        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(255)")]
        public string Extension { get; set; }

        [SugarColumn(IsIgnore = true, ColumnDataType = "varchar(255)")]
        public string ObjectKey { get => this.Path.Substring(1) +"/"+ this.ImageName + "." + Extension; }


        [SugarColumn(IsIgnore = true, ColumnDataType = "varchar(max)")]
        public string  PreviewUrl { get; set; } 

        
    }
}
